﻿using AutoMapper;
using Sharp.DataTransferObject;
using Sharp.Infrastructure.Interfaces;
using Sharp.Web.Models;

namespace Sharp.Web
{
    public class AutoMapperBootStrapper : IBootstrapPlugin
    {
        public void Initialize()
        {
            Mapper.Initialize(cfg =>
            {
                #region 用户


                cfg.CreateMap<UserDTO, UserModel>()
                   .ReverseMap();

                cfg.CreateMap<UserLogDTO, UserLogModel>()
                   .ReverseMap();
                cfg.CreateMap<UserGroupDTO, UserGroupModel>()
                   .ReverseMap();
                #endregion

                cfg.CreateMap<OrgDTO, OrgModel>()
                                  .ReverseMap();
                cfg.CreateMap<EmployeeDTO, EmployeeModel>()
                                    .ReverseMap();
                cfg.CreateMap<GroupDTO, GroupModel>()
                                    .ReverseMap();
                cfg.CreateMap<JobDTO, JobModel>()
                                    .ReverseMap();
                cfg.CreateMap<MessageDTO, MessageModel>()
                                    .ReverseMap(); 
                cfg.CreateMap<SubSystemDTO, SubSystemModel>()
                                  .ReverseMap();
                cfg.CreateMap<UserGroupDTO, UserGroupModel>()
                                    .ReverseMap();
            });
            this.IsAlready = true;
        }

        public bool IsAlready { get; set; }
    }
}